<?php
/*
	我的下线
*/
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'main';
if($_RQ['op']=='main'){
	if($_RQ['is_access']){
		$member=$this->model('member')->checkmember('',true);
	}else{
		$member=$this->model('member')->checkmember('',false);
	}
	$return['ischecklogin']=model('jy_weishop/member')->checklogin('','','','',true);
	$return['setting']=$this->plugin_setting('page_setting');	
	$return['params']=array('page'=>1,'level'=>1);
	$return['psize']=20;
	$return['list']=array();
	$member=model('core/member')->detail($_SESSION['uid'],array('credit1','credit2','credit3','credit4','credit5','credit6','mobile','avatar','nickname'));
	$member2=$this->get('member',array('mid'=>$_SESSION['uid']));
	$member['lastfanfee']=$this->sum('fanlog',array('uniacid'=>$_SESSION['uniacid'],'mid'=>$_SESSION['uid']),'lastfanfee');
	$member=array_merge($member2,$member);
	$return['member']=$member;
	set_html('title',$return['setting']['tmydown']?:'我的下线');
	exi($return);
}
if($_RQ['op']=='list'){
	$params=array('uniacid'=>$_SESSION['uniacid'],'mid'=>$_SESSION['uid']);
	$psize=10;
	$pindex=intval($_RQ['page'])?:1;
	$parameter=array(
		'params'=>$params,
		'limit'=>array($pindex,$psize),
		'orderby'=>'id desc',
	);
	$list=$this->get_list('fanlog',$parameter);
	if(!$list){
		exi('none');
	}
	$bgcolor=array('#4491F1','#FF4444','#e1251b','#d62f35','#FF547B','#7783EA','#FCC600','#63BE72','#ff9999','#cdab6a');
	foreach($list as &$item){
		$colorkey=mb_substr($item['id'],-1);
		$item['bgcolor']=$bgcolor[$colorkey];
		$item['createtime']=date('Y-m-d H:i:s',$item['createtime']);
		$item['uptime']=date('Y-m-d H:i:s',$item['uptime']);
		$item['isfee']=price($item['fanfee']-$item['lastfanfee']);
		$item['statustitle']=$this->fanlog_status[$item['status']];
	}
	exi($list);
}
?>